package com.woniu.order.controller;


import cn.hutool.core.bean.BeanUtil;
import com.woniu.model.Result;
import com.woniu.order.form.AddVisitForm;
import com.woniu.order.model.TVisit;
import com.woniu.order.param.AddVisitParam;
import com.woniu.order.service.TVisitService;
import com.woniu.order.util.RedisUtil;
import com.woniu.utils.JwtUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 吴彦祖
 * @since 2024年06月05日
 */
@RestController
@RequestMapping("/tVisit")
//@Api(tags = "回访服务")
public class TVisitController {
    @Resource
    private TVisitService tVisitService;

    @Resource
    private RedisUtil redisUtil;

//    /**
//     * 站长回访
//     * @param form 表单id 回访记录信息
//     * @param token
//     * @return 生成记录
//     */
//    @ApiOperation("站长回访")
//    @PostMapping("/userVisit")
//    public Result userVisit(@RequestBody AddVisitForm form,@RequestHeader("token") String token) throws Exception {
//        String refreshToken = redisUtil.get(token);
//        Integer userId = Integer.parseInt(JwtUtil.parseToken(refreshToken,JwtUtil.stationBossSecret).get("id").toString());
//
//        TVisit tVisit = tVisitService.userVisit( userId,BeanUtil.toBean(form, AddVisitParam.class));
//        return Result.newInstance(TVisit.class).setData(tVisit).setMessage("回访成功");
//    }

}

